<html>
<head><meta charset="utf-8"><title>miri is great · wg-secure-code · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/index.html">wg-secure-code</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html">miri is great</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="196595194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196595194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brian Anderson <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196595194">(May 06 2020 at 07:11)</a>:</h4>
<p>I've been finding tons of bugs with miri lately. It's awesome @oli <span class="user-mention" data-user-id="120791">@RalfJ</span></p>



<a name="196632410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196632410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Shnatsel <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196632410">(May 06 2020 at 13:16)</a>:</h4>
<p>I'm curious, what kind of bugs those were? Alignment issues, several mutable references, out-of-bounds accesses, uninit memory reads, double-frees?</p>



<a name="196680959"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196680959" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196680959">(May 06 2020 at 19:00)</a>:</h4>
<p><span class="user-mention" data-user-id="294773">@Brian Anderson</span> thanks &lt;3 I'm glad it is helpful for you :)</p>



<a name="196681046"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196681046" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196681046">(May 06 2020 at 19:00)</a>:</h4>
<p><span class="user-mention" data-user-id="127617">@Shnatsel</span> at least some are listed at <a href="https://github.com/rust-lang/miri#bugs-found-by-miri" title="https://github.com/rust-lang/miri#bugs-found-by-miri">https://github.com/rust-lang/miri#bugs-found-by-miri</a></p>



<a name="196709517"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196709517" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brian Anderson <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196709517">(May 06 2020 at 23:12)</a>:</h4>
<p><span class="user-mention" data-user-id="127617">@Shnatsel</span>  multiple alignment issues, one out-of-bounds pointer, one overlapping mutable reference, several stacked borrows. The tikv, servo_arc, and ryu links in the <a href="https://github.com/rust-lang/miri" title="https://github.com/rust-lang/miri">miri trophy case</a> are just some of them. I have more to submit yet.</p>



<a name="196711617"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196711617" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Shnatsel <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196711617">(May 06 2020 at 23:43)</a>:</h4>
<p>Nice! I'm curious, how do you run something as big as TiKV in miri? And how do you approach running miri on an unfamiliar codebase? I've tried running simple tests in it, like decompressing a 1kb PNG file, but that took longer than I was willing to wait (3 hours).</p>



<a name="196711921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196711921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Shnatsel <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196711921">(May 06 2020 at 23:48)</a>:</h4>
<p>And also thanks for doing that, this kind of work is super important</p>



<a name="196715392"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196715392" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brian Anderson <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196715392">(May 07 2020 at 00:37)</a>:</h4>
<p>For tikv specifically, i first went after the "leaf" crates, and ran their test suites. every time miri hits something it can't handle i hack up the code to ignore that test, and keep going until as much of the test suite runs to completion. then repeat outward in the crate dag. it helps a lot that tikv is broken up into a number of smaller crates, many of which are compute-centric. i've mostly-fully-tested the parts of tikv that are involved in accelerated computation, but not even tried the parts that deal with storage. I run miri with -Zmiri-disable-isolation. It also requires getting used to and working around miri's relatively buggy CLI.</p>



<a name="196715404"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196715404" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brian Anderson <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196715404">(May 07 2020 at 00:37)</a>:</h4>
<p>can't run benches in miri as of now, which is a bummer</p>



<a name="196717025"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196717025" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Shnatsel <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196717025">(May 07 2020 at 01:05)</a>:</h4>
<p>Interesting, thanks. Benches can be run with Address Sanitizer, but it will not notice alignment issues or stacked borrows violations or reads from uninit memory. It's very straightforward and will reveal out-of-bounds accesses or use-after-frees though. I don't expect much of that to happen on well-formed inputs used in tests or benchmarks, this is where fuzzers come into play.</p>



<a name="196745611"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196745611" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196745611">(May 07 2020 at 09:24)</a>:</h4>
<p>I had the same question, thanks for explaining <span class="user-mention" data-user-id="294773">@Brian Anderson</span> . I would have been quite surprised indeed if you could have run the database itself in Miri.</p>
<p>I take it these crates also have their own test suites that you can easily run in Miri then?</p>



<a name="196745676"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196745676" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196745676">(May 07 2020 at 09:24)</a>:</h4>
<blockquote>
<p>It also requires getting used to and working around miri's relatively buggy CLI.</p>
</blockquote>
<p>Yeah our cargo wrapper is quite the mess. :/ Which problems are you running into, and is there something we should know about that is not <a href="https://github.com/rust-lang/miri/issues?q=is%3Aopen+is%3Aissue+label%3AA-cargo" title="https://github.com/rust-lang/miri/issues?q=is%3Aopen+is%3Aissue+label%3AA-cargo">listed here</a> yet?</p>



<a name="196745685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196745685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196745685">(May 07 2020 at 09:24)</a>:</h4>
<p>Implement network support, and it may be possible</p>



<a name="196745855"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196745855" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196745855">(May 07 2020 at 09:26)</a>:</h4>
<p><span class="user-mention" data-user-id="127617">@Shnatsel</span> in my experience adjusting test suites to not take forever in Miri, I usually have to get iteration counts down into the low 3 digits or even lower. Not sure if such a small PNG file is realistic, but it might be worth a shot.^^</p>



<a name="196746108"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196746108" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196746108">(May 07 2020 at 09:29)</a>:</h4>
<p>There are a few people working on a meta-tracer for rust: <a href="https://github.com/softdevteam/yk" title="https://github.com/softdevteam/yk">https://github.com/softdevteam/yk</a> Once it can run most programs, it should theoretically be possible to improve the performance of Miri by running Miri in it.</p>



<a name="196746268"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196746268" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196746268">(May 07 2020 at 09:30)</a>:</h4>
<p>I have no idea what a meta-tracer is</p>



<a name="196746618"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196746618" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196746618">(May 07 2020 at 09:34)</a>:</h4>
<p>Rpython is an example of a meta-tracer. The basic idea is that you write an interpreter for a language. For example pypy is a python interpreter written in rpython. Then the meta-tracer will find traces (linear sets of instructions without branches) in the interpreted language and compiles an interpreter that only executes that specific trace. It can thus specialize for that specific trace.</p>



<a name="196747102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196747102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196747102">(May 07 2020 at 09:39)</a>:</h4>
<p><a href="http://dom.parnaiba.pi.gov.br/assets/diarios-anteriores/bolz-tracing-jit-final.pdf" title="http://dom.parnaiba.pi.gov.br/assets/diarios-anteriores/bolz-tracing-jit-final.pdf">http://dom.parnaiba.pi.gov.br/assets/diarios-anteriores/bolz-tracing-jit-final.pdf</a></p>



<a name="196758221"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196758221" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196758221">(May 07 2020 at 11:38)</a>:</h4>
<p>It's a great piece of black magic, but I am cautious about predicting how well it would work with miri. I believe a great chunk of miri's overhead is due to the extensive runtime instrumentation (as opposed to just dynamic dispatch etc.), and I don't see how a tracing JIT can remove most of that. For example, if you specializing traces to the assumption of "no UB", you still need to instrument the program's memory with borrow stacks and undef masks to know when UB happens, you still need to update and check that metadata on each memory access, etc. -- in much the same way that PyPy and the like still need to store type information in (escaped) objects and perform type checks; but the cost of miri's "metadata" is much higher. I'm sure these checks can be folded away or "batched" to some degree by generic optimizations on traces, but I expect speedups to be limited as long as miri itself is structured as it is now.</p>



<a name="196758447"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196758447" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196758447">(May 07 2020 at 11:41)</a>:</h4>
<p>(Of course I would be happy to be proven wrong. The above can just as well be taken as "things to keep in mind" rather than "reasons why it will NEVER work" ^^)</p>



<a name="196762038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196762038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196762038">(May 07 2020 at 12:22)</a>:</h4>
<p>A quick profiling on <a href="https://github.com/bjorn3/rustc_codegen_cranelift/blob/master/example/mod_bench.rs" title="https://github.com/bjorn3/rustc_codegen_cranelift/blob/master/example/mod_bench.rs">https://github.com/bjorn3/rustc_codegen_cranelift/blob/master/example/mod_bench.rs</a> show the following:</p>
<ul>
<li>value validation (validate_operand_internal): ~17%</li>
<li>monomorphization (subst_and_normalize_erasing_regions): ~4.4% (should be removable by tracer)</li>
<li>layout (tcx.layout_of): ~5.5% (should be removable by tracer)</li>
<li>try_read_immediate: ~10% (I think a tracer can make it cheaper)</li>
</ul>
<p><a href="https://www.speedscope.app/#profileURL=https://gist.githubusercontent.com/bjorn3/d703bbc610695359ab4501232f36a9ff/raw/6dfbf30c78f6733616c027debc360710d991555a/gistfile1.txt" title="https://www.speedscope.app/#profileURL=https://gist.githubusercontent.com/bjorn3/d703bbc610695359ab4501232f36a9ff/raw/6dfbf30c78f6733616c027debc360710d991555a/gistfile1.txt">https://www.speedscope.app/#profileURL=https://gist.githubusercontent.com/bjorn3/d703bbc610695359ab4501232f36a9ff/raw/6dfbf30c78f6733616c027debc360710d991555a/gistfile1.txt</a></p>



<a name="196768076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196768076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196768076">(May 07 2020 at 13:17)</a>:</h4>
<p>This is great data! So if we assume that those 17% spent in validation isn't sped up at all by tracing (unrealistic; but we're also ignoring all sorts of other effects, this is just to get a rough idea) then Amdahl's law predicts a maximum speedup of ca. 6x in the limit.</p>



<a name="196768743"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196768743" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196768743">(May 07 2020 at 13:22)</a>:</h4>
<p>There is also ~7.1% time spent on allocations. (<code>cat profile | rg "malloc|calloc|realloc|memmove|memcpy|free" &gt; profile2</code> and then divide sample count.)</p>
<p>Edit: added <code>free</code> to the filter</p>



<a name="196769428"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196769428" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196769428">(May 07 2020 at 13:27)</a>:</h4>
<p>Although that's something where the usual tracing JIT tricks unboxing non-escaping values and SROA'ing interpreter frames might help to some degree.</p>



<a name="196769503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196769503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196769503">(May 07 2020 at 13:28)</a>:</h4>
<p>(which you also have to bet on if you want to count e.g. <code>layout_of</code> as something tracing would help with)</p>



<a name="196769728"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196769728" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196769728">(May 07 2020 at 13:29)</a>:</h4>
<p>Most memory allocations are for <code>Vec</code>, not <code>Box</code>.</p>



<a name="196772011"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196772011" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196772011">(May 07 2020 at 13:45)</a>:</h4>
<p>If that's in response to "unboxing non-escaping locals", I don't mean Rust's <code>Box</code> but temporaries placed in stack frames or other miri allocations (which btw are mostly composed of various <code>Vec</code>s), analogous to how PyPy etc. might avoid allocating an <code>int</code> object for temporary integer values. But I now realize that this is complicated by the fact that miri allocations are all bags of bytes, not discrete high-level values. I don't think JIT compilers for machine code emulation (which are similarly operating on untyped bytes) have similar tricks up their sleeve, so maybe the usual tricks won't even work for this.</p>



<a name="196775380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196775380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196775380">(May 07 2020 at 14:09)</a>:</h4>
<p>You wrote non-escaping values, not locals, so I thought you were talking about values inside miri, not the interpreted code. For the interpreted code we could make <code>IndexVec&lt;Local, LocalState&gt;</code>turn into a single <code>Allocation</code> when the live state and layout for all locals is known as part of the trace.</p>



<a name="196775802"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196775802" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196775802">(May 07 2020 at 14:12)</a>:</h4>
<p>This is starting to sound like the kind of invasive refactoring/optimization "to help the JIT along" that I intentionally excluded from consideration earlier ("miri [...] structured as it is now") because I can't judge how practical they are nor estimate how much speed-up you could get with the same effort by just optimizing the interpreter.</p>



<a name="196776292"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196776292" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Hanna Kruppe <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196776292">(May 07 2020 at 14:14)</a>:</h4>
<p>(But also, merging all the locals into a single allocation seems the opposite of helpful for the problem I was musing about.)</p>



<a name="196779444"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196779444" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196779444">(May 07 2020 at 14:36)</a>:</h4>
<p>Something with a more immediate effect may be shrinking core type like <code>OpTy</code>. That type is for example 64 bytes big, resulting in quite a lot of <code>movaps</code>/<code>movups</code> instructions to copy it around.</p>



<a name="196834061"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196834061" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brian Anderson <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196834061">(May 07 2020 at 21:43)</a>:</h4>
<blockquote>
<p>Yeah our cargo wrapper is quite the mess. :/ Which problems are you running into, and is there something we should know about that is not listed here yet?</p>
</blockquote>
<p>The big one is that workspaces don't work correctly. ISTR that cargo miri also runs benches in cases where cargo test does not, and that it intercepts --help as its own argument in a position where it should be passed to the test binary (thus I couldn't teach myself how to turn benches off manually).</p>



<a name="196834084"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196834084" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brian Anderson <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196834084">(May 07 2020 at 21:43)</a>:</h4>
<p><span class="user-mention" data-user-id="120791">@RalfJ</span> ^</p>



<a name="196834178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196834178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brian Anderson <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196834178">(May 07 2020 at 21:44)</a>:</h4>
<p>One other thing that ended up being a problem was miri just stopping with an error in a way that _seemed_ like it was a timeout but didn't say so.</p>



<a name="196834224"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196834224" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Brian Anderson <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196834224">(May 07 2020 at 21:45)</a>:</h4>
<p>No backtraces or anything, just a nondescript error</p>



<a name="196838168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196838168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Shnatsel <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196838168">(May 07 2020 at 22:27)</a>:</h4>
<p>miri has also shown a whole heap of issues with <code>bigint</code> crate: <a href="https://github.com/RustSec/advisory-db/pull/290" title="https://github.com/RustSec/advisory-db/pull/290">https://github.com/RustSec/advisory-db/pull/290</a><br>
<span class="user-mention" data-user-id="294773">@Brian Anderson</span> I would appreciate if you could run <code>bigint</code>'s successor, <a href="https://crates.io/crates/uint" title="https://crates.io/crates/uint"><code>uint</code></a>, in miri so we could get an idea of whether we should recommend it as a replacement in a RustSec advisory.</p>



<a name="196838266"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196838266" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Shnatsel <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196838266">(May 07 2020 at 22:28)</a>:</h4>
<p>in the meanwhile I'm fuzzing <a href="https://github.com/main--/rust-lz-fear" title="https://github.com/main--/rust-lz-fear">https://github.com/main--/rust-lz-fear</a>, found an OOM and a couple of panics so far, but I don't expect any fireworks since it's all safe code</p>



<a name="196866722"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196866722" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196866722">(May 08 2020 at 07:48)</a>:</h4>
<p><span class="user-mention" data-user-id="294773">@Brian Anderson</span> yeah, workspaces <a href="https://github.com/rust-lang/miri/issues/1001" title="https://github.com/rust-lang/miri/issues/1001">don't work</a> and I am not sure how to best make them work. :/ it doesn't help that I myself don't really use workspaces either so I hardly know how they function.<br>
I'd be surprised if it ran benches, that shouldn't happen -- but maybe you ran into <a href="https://github.com/rust-lang/miri/issues/700" title="https://github.com/rust-lang/miri/issues/700">this problem</a> ?<br>
For <code>--help</code>, thanks for letting me know! I wasn't aware and this should not be hard to fix. <code>cargo miri test -- -- --help</code> should show the test runner's help.</p>



<a name="196866750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/196866750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#196866750">(May 08 2020 at 07:48)</a>:</h4>
<p><span class="user-mention silent" data-user-id="294773">Brian Anderson</span> <a href="#narrow/stream/146229-wg-secure-code/topic/miri.20is.20great/near/196834224" title="#narrow/stream/146229-wg-secure-code/topic/miri.20is.20great/near/196834224">said</a>:</p>
<blockquote>
<p>No backtraces or anything, just a nondescript error</p>
</blockquote>
<p>you dont happen to know the error message? there should always be a backtrace -- or else it's an ICE and thus (almost always) a bug.</p>



<a name="197108508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/197108508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#197108508">(May 11 2020 at 07:22)</a>:</h4>
<p><span class="user-mention silent" data-user-id="120791">RalfJ</span> <a href="#narrow/stream/146229-wg-secure-code/topic/miri.20is.20great/near/196866750">said</a>:</p>
<blockquote>
<p><span class="user-mention silent" data-user-id="294773">Brian Anderson</span> <a href="#narrow/stream/146229-wg-secure-code/topic/miri.20is.20great/near/196834224">said</a>:</p>
<blockquote>
<p>No backtraces or anything, just a nondescript error</p>
</blockquote>
<p>you dont happen to know the error message? there should always be a backtrace -- or else it's an ICE and thus (almost always) a bug.</p>
</blockquote>
<p>I also saw a case where Miri did not report any error message, except for having an error exit code. My understanding (potentially completely wrong) of that case was that Miri exhausted all RAM on my machine and got killed by the OS.</p>



<a name="197116449"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/197116449" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#197116449">(May 11 2020 at 08:47)</a>:</h4>
<p>If you are using Linux, dmesg should show a message about the OOM killer if miri was killed due to OOM.</p>



<a name="197287477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/197287477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vytautas Astrauskas [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#197287477">(May 12 2020 at 14:52)</a>:</h4>
<p><span class="user-mention silent" data-user-id="133247">bjorn3</span> <a href="#narrow/stream/146229-wg-secure-code/topic/miri.20is.20great/near/197116449">said</a>:</p>
<blockquote>
<p>If you are using Linux, dmesg should show a message about the OOM killer if miri was killed due to OOM.</p>
</blockquote>
<p>Thanks for the tip!</p>



<a name="197838189"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146229-wg-secure-code/topic/miri%20is%20great/near/197838189" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146229-wg-secure-code/topic/miri.20is.20great.html#197838189">(May 17 2020 at 08:46)</a>:</h4>
<p>While I have the attention of some Miri users, could I ask you for feedback on <a href="https://github.com/rust-lang/miri/issues/1416">this issue</a> concerning a potential breaking change in <code>cargo miri test</code> argument handling? Cc <span class="user-mention" data-user-id="294773">@Brian Anderson</span> who struggled with this I think</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>